package niit.wei.dao;

import niit.wei.entity.Book;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public interface BookDao {
    /**
     * 新增图书
     * @param conn
     * @param sql
     * @param args
     */
    void addBook(Connection conn, String sql, Object... args) throws SQLException;

    /**
     * 更新图书
     * @param conn
     * @param sql
     * @param args
     */
    void updateBook(Connection conn, String sql, Object... args) throws SQLException;

    /**
     * 删除图书
     * @param conn
     * @param sql
     * @param args
     */
    void deleteBook(Connection conn, String sql, Object... args) throws SQLException;

    /**
     *
     * @param conn
     * @param sql
     * @param clazz 类型
     * @param args
     * @return
     */
    List<Book> getBookList(Connection conn, String sql, Class<Book> clazz, Object... args) throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException;

    Book getBook(Connection conn, String sql, Class<Book> clazz, Object... args) throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException;

    /**
     *获取总记录数
     * @param conn
     * @param sql
     * @param args
     * @return
     */
    Long getBookCount(Connection conn, String sql, Object... args) throws SQLException;
}
